from django.db import models

# Create your models here.


class UploadImg(models.Model):

    path = models.CharField(verbose_name="路径", max_length=256, null=True, blank=True)
    n_path = models.CharField(verbose_name="路径", max_length=256, null=True, blank=True)
    is_acc = models.IntegerField(verbose_name='是否准确', default=0, blank=True)
    timer = models.DateTimeField(verbose_name='上传时间', auto_now_add=True)


class PetType(models.Model):
    name = models.CharField(verbose_name="名字", max_length=32)


class PetCls(models.Model):
    name = models.CharField(verbose_name="名字", max_length=32)
    type = models.ForeignKey('PetType', on_delete=models.CASCADE, null=True, blank=True)
    path = models.CharField(verbose_name="路径", max_length=256, null=True, blank=True)
    describe = models.CharField(verbose_name="描述", max_length=1024, null=True, blank=True)


class PetImg(models.Model):
    classify = models.ForeignKey('PetCls', on_delete=models.CASCADE, null=True, blank=True)
    path = models.CharField(verbose_name="路径", max_length=256, null=True, blank=True)


class Logs(models.Model):
    name = models.CharField(verbose_name="名字", max_length=32)
    result = models.CharField(verbose_name="描述", max_length=5120, null=True, blank=True)
    timer = models.DateTimeField(verbose_name="时间", auto_now_add=True, blank=True)
    ip = models.GenericIPAddressField(verbose_name='ip', null=True, blank=True)
    im = models.ForeignKey('UploadImg', on_delete=models.SET_NULL, null=True, blank=True)
